using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Text;

namespace Momentum.Types
{

    public class mBullet : mObject
    {

        #region Initialization

        public mBullet(mWeapon weapon)
            : base()
        {
            m_CollisionRadius = weapon.CollisionRadius;
            m_Mass = weapon.Mass;
            m_ObjectScale = weapon.ObjectScale;
            m_ShadowOffset = weapon.ShadowOffset;
            m_HP = weapon.TotalHP;
            m_ObjectTexture = weapon.ObjectTexture;
            m_ObjectShadowTexture = weapon.ObjectShadowTexture;
        }

        public mBullet(mWeapon weapon, mTank tank)
            : base()
        {
            m_CollisionRadius = weapon.CollisionRadius;
            m_Mass = weapon.Mass;
            m_ObjectScale = weapon.ObjectScale;
            m_ShadowOffset = weapon.ShadowOffset;
            m_ObjectRotation = tank.TurretRotation;
            m_Position = tank.Position +
                new Vector2(tank.CollisionRadius * tank.ObjectScale * (float)Math.Cos(m_ObjectRotation),
                    tank.CollisionRadius * tank.ObjectScale * (float)Math.Sin(m_ObjectRotation)) +
                new Vector2(2 * weapon.CollisionRadius * weapon.ObjectScale * (float)Math.Cos(m_ObjectRotation),
                    2 * weapon.CollisionRadius * weapon.ObjectScale * (float)Math.Sin(m_ObjectRotation));
            m_HP = weapon.TotalHP;
            m_Velocity = new Vector2(weapon.InitialVelocity * (float)Math.Cos(m_ObjectRotation),
                weapon.InitialVelocity * (float)Math.Sin(m_ObjectRotation));
            m_ObjectTexture = weapon.ObjectTexture;
            m_ObjectShadowTexture = weapon.ObjectShadowTexture;
        }

        #endregion

    }

}
